home *** CD-ROM | disk | FTP | other *** search
/ boe.pres.k12.wv.us / boe.pres.k12.wv.us.zip / boe.pres.k12.wv.us / Utilities / Xerox Workcentre 5335 / Windows Scan / 64-bit_x64 / Russian / cpsimage.cab / data / xps / pdf2xps.elf < prev    next >
Text File  |  2009-04-23  |  1KB  |  51 lines

  1. /*
  2. ** A script to read PDF and emit XPS
  3. **
  4. ** M.Campanelli 11/1/05
  5. ** Updated 7/12/06
  6. ** Converted to use DOCUMENTWRITER 7/18/06 - Kingsley
  7. */
  8.  
  9. #import "documentio.ucm";
  10. #load "sys/stdlib.elf";
  11. LoadClasses (filename: "xeng");
  12.  
  13. // Give me a PDF file to convert
  14. IMPORT STRING infile;
  15.  
  16. // Error checking
  17. if ( !infile )
  18.   { print "Need infile argument, i.e.,  infile:s filename "; end; }
  19.  
  20. if ( !new(FILE, path : infile ).isFile() )
  21.   { print "invalid infile: " + infile; end; }
  22.  
  23. // Make a directory of the filename to collect XPS files in
  24. STRING dir = infile.name() + ".xps";
  25.  
  26. // Get a document reader
  27. DOCUMENTREADER dr = CreateDocumentReader (filename: infile);
  28.  
  29. // Verbose output
  30. INTEGER pgCnt = dr.getPageCount ();
  31. print infile + " has " + pgCnt + " pages";
  32.  
  33. DOCUMENTWRITER dw = CreateDocumentWriter( filename: dir, format:"xps");
  34.  
  35. // Variables
  36. INTEGER pgNum = 1;
  37. XIPIMAGE img;
  38. for ( pgNum=1; pgNum<=pgCnt; pgNum++ )
  39.    {
  40.    print "working on pg " + pgNum;
  41.    img = dr.getPage (pgnum:pgNum);
  42.    dw.appendPage(pgImg:img);
  43.    }
  44.  
  45. // Release resources
  46. dr.release();
  47. dw.release();
  48.  
  49. // How long has this taken
  50. print TimeCheck();
  51.